/*
 *  hihocoder.com
 *
 *  Category: Dynamic Programming
 */

/*-------- Includes --------*/
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

/*-------- Defines --------*/


/*-------- Types --------*/


/*-------- Global Variables --------*/
int N, N3;
int BJ, SH, NY;

int d[101][101];

/*-------- Function Prototypes --------*/


/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    cin >> N;

    N3 = N * 3;

    memset(d, -1, sizeof(d));
    d[0][0] = 0;

    for (int i = 1; i <= N3; ++i) {
        cin >> BJ >> SH >>  NY;

        for (int j = N; j >= 0; --j) {
            for (int k = N; k >= 0; --k) {
                if (j + k > i) continue;

                if (d[j][k] != -1)
                    d[j][k] += BJ;

                if (j > 0) d[j][k] = max(d[j][k], d[j-1][k] + SH);
                if (k > 0) d[j][k] = max(d[j][k], d[j][k-1] + NY);
            }
        }
    }

    cout << d[N][N] << endl;

    return 0;
}

/*-------- Functions --------*/

